"""
电商视图模块

"""

from django.shortcuts import render
from django.shortcuts import render_to_response
from Goods.models import *
import random
# Create your views here.



def index(request):
    """
    展示首页
    :param request:
    :return:
    """
    return render_to_response("index.html")


def goods(request):
    """
    商品管理页面
    :param request:
    :return:
    """
    return render_to_response("goods.html")


def orders(request):
    """
    订单管理页面
    :param request:
    :return:
    """
    return render_to_response("orders.html")


def statistics_goods(request):
    """
    商品统计页面
    :param request:
    :return:
    """
    return render_to_response("statistics_goods.html")


def statistics_orders(request):
    """
    订单统计页面
    :param request:
    :return:
    """
    return render_to_response("statistics_orders.html")


def store(request):
    """
    店铺详情页面
    :param request:
    :return:
    """
    return render_to_response("store.html")



# goods_list = """白菜、菠菜、油菜、卷心菜、苋菜、韭菜、蒿菜、香菜、芥菜、芥兰、茴香、蒜苗、莴笋、空心菜、豌豆尖、生菜、白花菜、青花菜、油麦菜、甘蓝、小葱、萝卜、马铃薯、藕、甘薯、山药、芋头、茭白、苤蓝、慈姑、洋葱、生姜、大蒜、蒜薹、韭菜花、大葱、韭黄、冬瓜、南瓜、西葫芦、丝瓜、黄瓜、茄子、西红柿、苦瓜
# 、辣椒、玉米、小瓜、毛豆、豌豆、蚕豆、扁豆、豇工、四季豆、香菇、平菇、金针菇、木耳、银耳、杏鲍菇、口蘑""".split("、")
# print(goods_list)
# address_list = """石河子、阿拉尔市、图木舒克、五家渠、哈密、吐鲁番、阿克苏、喀什、和田、伊宁、塔城、阿勒泰、奎屯、博乐、昌吉、阜康、库尔勒、阿图什、乌苏、郑州、洛阳、开封、漯河、安阳、新乡、周口、三门峡、焦作、平顶山、信阳、南阳、鹤壁、濮阳、许昌、商丘、驻马店、南宁、柳州、桂林、梧州、北海、崇左、来宾、贺州、玉林、百色、河池、钦州、防城港、贵港""".split("、")
# print(address_list)

# def test(request):
#     for i in range(20000):
#         g = Goods()
#         g.g_id = str(i).zfill(6)
#         g.g_name = random.choice(address_list)+random.choice(goods_list)
#         g.g_price = random.randint(0,200)
#         g.g_old_price = random.randint(0,200)
#         g.g_period = "{}-{}-{}".format(
#             random.randint(2000, 2020),
#             random.randint(1, 12),
#             random.randint(1, 28),
#         )
#         g.g_shelf = "{}月".format(random.randint(1,13))
#         g.g_description = "好吃不贵"
#         g.g_picture = "img/1.jpg"
#         g.g_quantity = random.randint(1,1000)
#         g.g_types = "蔬菜"
#         g.g_owned = random.choice(["天天生鲜", "京东超市","天猫商城","老王水果摊"])
#         # g.save()
#     return render_to_response("test.html")